package com.learn.eduadboot.controller;


import com.learn.common.result.Result;
import com.learn.eduadboot.entity.PromotionAd;
import com.learn.eduadboot.service.PromotionAdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 广告表 前端控制器
 * </p>
 *
 * @author m
 * @since 2022-04-22
 */
@RestController
@RequestMapping("/ad/ad")
@CrossOrigin
public class PromotionAdController {
    @Autowired
    private PromotionAdService promotionAdService;

    @GetMapping("getAdsBySpaceId/{spaceid}")
    public Result getAdsBySpaceId(@PathVariable("spaceid") Integer sid){
        List<PromotionAd> list = promotionAdService.getAdsBySpaceId(sid);
        return Result.ok().setData("data",list);
    }
}

